<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta name="renderer" content="webkit">
<title>内容编辑</title>
<link rel="stylesheet" href="__PUBLIC__/css/pintuer.css">
<link rel="stylesheet" href="__PUBLIC__/css/admin.css">
<script src="__PUBLIC__/js/jquery.js"></script>
<script src="__PUBLIC__/js/pintuer.js"></script>

<link type="text/css" rel="stylesheet" href="/Public/Plugins/jquery-time/admin.css" />
<link rel="stylesheet" type="text/css" href="/Public/Plugins/jquery-time/jquery-ui.css" />
<script type="text/javascript" src="/Public/Plugins/jquery-time/jquery-ui-1.10.4.custom.min.js"></script>
<script type="text/javascript" src="/Public/Plugins/jquery-time/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/Public/Plugins/jquery-time/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="/Public/Plugins/jquery-time/jquery-ui-timepicker-zh-CN.js"></script>
<style type="text/css">
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.ui-timepicker-div dl { text-align: left; }
.ui-timepicker-div dl dt { float: left; clear:left; padding: 0 0 0 5px; }
.ui-timepicker-div dl dd { margin: 0 10px 10px 45%; }
.ui-timepicker-div td { font-size: 90%; }
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; padding: 0 5px 0 0; }
.ui-timepicker-rtl dl dt{ float: right; clear: right; }
.ui-timepicker-rtl dl dd { margin: 0 45% 10px 10px; }
.inputfile {width: 0.1px; height: 0.1px; opacity: 0; overflow: hidden; position: absolute; z-index: -1;}
.input{width:50%;}
select{height:40px;}

</style>

<js file="/Public/Ueditor/ueditor.config.js"/>  
<js file="/Public/Ueditor/ueditor.all.min.js"/>  
<script type="text/javascript" charset="utf-8">
  window.onload=function(){
    UE.getEditor('contents');
    }
</script> 
</head>
<body>
<div class="panel admin-panel">
  <div class="panel-head" id="add"><strong><span class="icon-pencil-square-o"></span>编辑内容</strong></div>
  <div class="body-content">
    <form method="post" id="editid" enctype="multipart/form-data" class="form-x" action="{:U('Admin/Article/edit')}">  
      <div class="form-group">
        <div class="label">
          <label>标题：</label>
        </div>
        <div class="field">
          <input type="hidden" name="id" value="{$data.id}" />
          <input type="text" class="input" style="width:60%;float:left;" maxlength="100" value="{$data.title}" name="title" data-validate="required:请输入标题" />
          <div class="tips"></div>
        </div>
      </div>

        <div class="form-group">
          <div class="label">
            <label>分类：</label>
          </div>
          <div class="field" style="width:50%">
            <select id="cateid" name="classid" class="input w50">
            <option value="0">选择分类</option>
              <foreach name="data.cate" item="list">
    			<option value="{$list.id}">{$list.name}</option>
    			<foreach name="list.child" item="child">
        		<option value="{$child.id}">&nbsp;&nbsp;&nbsp;&nbsp;|--{$child.name}</option>
        			<foreach name="child.child" item="three">
           			<option value="{$three.id}">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|--{$three.name}</option>
        			</foreach>
    			</foreach>
			</foreach>
            </select>
            <div class="tips"></div>
          </div>
        </div>
   
      <div class="form-group">
        <div class="label">
          <label>内容：</label>
        </div>
        <div class="field">
          <textarea name="content" id="contents" style="width:870px;height:300px;">{$data.content}</textarea>
          <div class="tips"></div>
        </div>
      </div>
     
      <div class="clear"></div>
      
       <div class="form-group">
        <div class="label">
          <label>标签：</label>
        </div>
        <div class="field">
          <input type="hidden" name="_tag" value="{$data.tagdata}"/>
          <input type="text" class="input" maxlength="100" placeholder="每个标签以逗号分隔" name="tag" value="{$data.tagdata}"/>
        </div>
      </div>
   
      <div class="form-group">
        <div class="label">
          <label>关键字：</label>
        </div>
        <div class="field">
          <input type="text" class="input" maxlength="100" placeholder="每个关键字以逗号分隔" name="keywords" value="{$data.keywords}"/>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>描述：</label>
        </div>
        <div class="field">
          <textarea type="text" class="input" name="desc" style="height:80px;">{$data.desc}</textarea>
        </div>
      </div>
       <div class="form-group">
        <div class="label">
          <label>缩略图：</label>
        </div>
        <div class="field">
  		  <input type="hidden" name="_pic" value="{$data.pic}">
          <input type="file" id="pic" name="pic"  class="input tips" style="width:25%; float:left;"  value=""  data-toggle="hover" data-place="right" data-image="__IMG__{$data.pic}" />
          <label for="pic" class="button bg-blue margin-left" style="float:left;width:150px;">+ 浏览上传</label>
          
          <div class="tipss">图片尺寸：{$data.piccf}</div>
        </div>
      </div>     
      
      <div class="form-group">
        <div class="label">
          <label>发布时间：</label>
        </div>
        <div class="field"> 
          <input type="text" class="laydate-icon input" style="width:15%; float:left;" name="dateline" value="{$data.dateline|date="Y-m-d H:i",###}" onclick="jjcss()" style="padding:10px!important; height:auto!important;border:1px solid #ddd!important;" />
         <div class="label" style="width:5%;">
          <label>排序：</label>
          </div>
        <input type="text" class="input w50" name="sort" onkeyup="value=value.replace(/[^\d]/g,'')" value="{$data.sort}" style="width:15%; float:left;" />
          <div class="tips"></div>
        </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label>作者：</label>
        </div>
        <div class="field">
          <input type="text" class="input" style="width:15%; float:left;" name="authour" value="{$data.authour}"  />
          <div class="label" style="width:5%;">
          <label>点击：</label>
          </div>
          <input type="text" class="input" style="width:15%; float:left;" name="views" value="{$data.views}" onkeyup="value=value.replace(/[^\d]/g,'')"  />
          
        </div>
      </div>
      <div class="form-group">
          <div class="label">
            <label>状态：</label>
          </div>
          <div class="field">
            <select id="state" name="state" class="input" style="width:15%; float:left;">
            <option value="1">发布</option>
    		<option value="0">草稿</option>
    		<option value="2">加密</option>
            </select>
            <span id="ccss" ></span>
          </div>
      </div>
      <div class="form-group">
          <div class="label">
            <label>属性：</label>
          </div>
          <div class="field" style="padding-top:8px;"> 
            	推荐 <input id="attr0" name="attr[0]"  type="checkbox" value="A1" />
           	 	置顶 <input id="attr1" name="attr[1]"  type="checkbox" value="B1" />
          </div>
      </div>
      <div class="form-group">
        <div class="label">
          <label></label>
        </div>
        <div class="field">
          <button class="button bg-main icon-check-square-o" type="submit"> 提交</button>
        </div>
      </div>
    </form>
  </div>
</div>

<script type="text/javascript">
$("#cateid").val("{$data['classid']}");
$( "input[name='dateline']" ).datetimepicker();
function jjcss(){
$("#ui-datepicker-div").css("z-index","9999");
}
$("#state").val("{$data.state}");
if({$data.state}==2){
	opt = '</label><input type="text" class="input" style="width:15%; float:left;" name="pwd" value="{$data.pwd}" maxlength="20" placeholder="请输入查看密码" />';
	$("#ccss").html(opt);
}
$("#state").change(function(){
	var valid=$(this).val();
	if(valid==2){
		opt = '</label><input type="text" class="input" style="width:15%; float:left;" name="pwd" value="{$data.pwd}" maxlength="20" placeholder="请输入查看密码" />';
		$("#ccss").html(opt);
	}else{
		$("#ccss").html('');
	}
	
});
var a1 = '{$data['attr'][0]}';
var b1 = '{$data['attr'][1]}';
if(a1=='A1'){
	$("#attr0").attr('checked','checked');
}
if(b1=='B1'){
	$("#attr1").attr('checked','checked');
}

/* function sumbit(){ 
	is_submit = true;
	document.getElementById('editid').submit();
}
var is_submit = false;
$(function(){
	var old_content = $("#contents").val();
	alert(old_content);
	
});

window.onbeforeunload = function(){
	
	var new_content = $("#contents").val();
	alert(new_content);
	if (!is_submit && (new_content != old_content)) return "当前的编辑内容还未保存";
} */

</script>

</body></html>